<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%String path = request.getContextPath() ;%>
<%@ taglib uri="/WEB-INF/tld/c.tld" prefix="c" %> 
<%@ taglib uri="/WEB-INF/tld/ui.tld" prefix="ui" %>
<!DOCTYPE html>
<html lang="zh-CN">
<head>
<meta http-equiv="X-UA-Compatible" content="IE=edge">
 <meta name="renderer" content="webkit">
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>查看发票信息</title>
<jsp:include page="../../import.jsp" flush="true" />
</head>
<body class="iframeBody">
 <div class="Wrapper">
           <div id="pageInTab" class="pageInTab">
               <form id="prj_prd_veh_info_form">
	              <!-- <div align="center"><span id="ocrBtn"  class="sq-button sq-button-round">OCR识别</span></div> -->
                     <div class="fieldset1 tabel_col clearFix">
                     	<div class="sqPanel">
				            <div class="sqPanel_head inL">
				                <span>发票扫描照片信息</span>
				            </div>
				            <table class="table_full tbl_1">
					            <tbody id="imgTable">
		
					            </tbody>
				            </table>
		  			 </div>
                     	<div class="fieldBox col_100">
				                 <div class="label">发票类别</div>
				                 <div class="field">
			                 		  <span><input name="invoiceType" type="radio" onclick="dynamic('1')" <c:if test='${vehInfo.invoiceType==1 }'> checked </c:if> value="1">机动车销售统一发票（非挂车）</span>
			                 		  <span><input name="invoiceType" type="radio" onclick="dynamic('2')" <c:if test='${vehInfo.invoiceType==2 }'> checked </c:if> value="2">机动车销售统一发票（挂车）</span>
			                 		  <span><input name="invoiceType" type="radio" onclick="dynamic('3')" <c:if test='${vehInfo.invoiceType==3 }'> checked </c:if> value="3">二手车销售统一发票（非挂车）</span>
		               	 			  <span><input name="invoiceType" type="radio"  onclick="dynamic('4')" <c:if test='${vehInfo.invoiceType==4 }'> checked </c:if> value="4">二手车销售统一发票（挂车）</span>
				           	 		  <span><input name="invoiceType" type="radio"  onclick="dynamic('5')" <c:if test='${vehInfo.invoiceType==5 }'> checked </c:if> value="5">其他发票（专票）</span> 
				           	 		  <span><input name="inType"  type="radio" onclick="dynamic('6')" <c:if test='${vehInfo.invoiceType==6 }'> checked </c:if> value="6">其他发票（普票）</span>
				                </div>
		               	</div>
						 <div class="fieldBox col_100">
							 <div class="label">发票类型</div>
							 <div class="field">
								 <span><input name="flag" type="radio" onclick="checkInvoiceFlagRepeat(this)" <c:if test='${vehInfo.flag==10 }'> checked </c:if> value="10">设备发票原件</span>
								 <span><input name="flag" type="radio" onclick="checkInvoiceFlagRepeat(this)" <c:if test='${vehInfo.flag==21 }'> checked </c:if> value="21">汽车配件票1 </span>
								 <span><input name="flag" type="radio" onclick="checkInvoiceFlagRepeat(this)" <c:if test='${vehInfo.flag==22 }'> checked </c:if> value="22">汽车配件票2 </span>
								 <span><input name="flag" type="radio" onclick="checkInvoiceFlagRepeat(this)" <c:if test='${vehInfo.flag==23 }'> checked </c:if> value="23">汽车配件票3 </span>
								 <span><input name="flag" type="radio" onclick="checkInvoiceFlagRepeat(this)" <c:if test='${vehInfo.flag==24 }'> checked </c:if> value="24">汽车配件票4 </span>
								 <span><input name="flag" type="radio" onclick="checkInvoiceFlagRepeat(this)" <c:if test='${vehInfo.flag==25 }'> checked </c:if> value="25">汽车配件票5 </span>
								 <span><input name="flag" type="radio" onclick="checkInvoiceFlagRepeat(this)" <c:if test='${vehInfo.flag==26 }'> checked </c:if> value="26">汽车配件票6 </span>
							 </div>
						 </div>
                     	 <div class="fieldBox col_50">
				                    <div class="label">客户名称</div>
				                    <div class="field">
				                 		  <span>${vehInfo.cstNm}</span>
				                    </div>
		               		 </div>
		               		  <div class="fieldBox col_50">
				                    <div class="label">合同号</div>
				                    <div class="field">
				                    <span><a href="javascript:prjDetailBtn(${vehInfo.prjId});">${lsCntNo}</a></span>
				                    </div>
		               		 </div>
		               		<div class="fieldBox col_50">
				                    <div class="label">支付表号</div>
				                    <div class="field">
				                      <span>${vehInfo.paySchNo}</span>
				                    </div>
		               		 </div>
		               		<div class="fieldBox col_50">
				                    <div class="label">租赁物名称</div>
				                    <div class="field">
				                    <span>${prdNm}</span>
				                    </div>
		               		 </div>
		               		 <div class="fieldBox col_50">
				                    <div class="label"><span class="requiredSymbol">*</span>发票代码</div>
				                    <div class="field">
				                    <span>${vehInfo.invoicecode}</span>
				                    </div>
		               		 </div>
		               		 <div class="fieldBox col_50">
				                    <div class="label"><span class="requiredSymbol">*</span>发票号码</div>
				                    <div class="field">
				                    <span>${vehInfo.invoicenum}</span>
				                    </div>
		               		 </div>
		               		 <div class="fieldBox col_50">
				                    <div class="label"><span class="requiredSymbol">*</span>开票日期</div>
				                    <div class="field">
				                    <span>${vehInfo.invoicedate}</span>
				                    </div>
		               		 </div>
		               		 
		               		 <div class="fieldBox col_50">
				                    <div class="label"><span class="requiredSymbol">*</span>
				                    	<c:if test="${vehInfo.invoiceType=='1'||vehInfo.invoiceType=='2'||vehInfo.invoiceType=='5'}">发票未税金额</c:if>
				                    	<c:if test="${vehInfo.invoiceType=='3'||vehInfo.invoiceType=='4' }">发票车价合计</c:if>
				                    	<c:if test="${vehInfo.invoiceType=='6'}">发票校验码后6位</c:if>
				                    </div>
				                    <div class="field">
				                    <span>
				                    	<c:if test="${vehInfo.invoiceType=='1'||vehInfo.invoiceType=='2'||vehInfo.invoiceType=='5'}">${vehInfo.untax }</c:if>
				                    	<c:if test="${vehInfo.invoiceType=='3'||vehInfo.invoiceType=='4' }">${vehInfo.invoiceTotal }</c:if>
				                    	<c:if test="${vehInfo.invoiceType=='6'}">${vehInfo.checkCode }</c:if>
				                    </span>
				                    </div>
		               		 </div>
		               		 
                     </div>
                    <br/>
                        <div class="fieldset1 tabel_col clearFix">
		               		  <div class="fieldBox col_50">
				                    <div class="label">购方名称</div>
				                    <div class="field">
				                     <span id="purchaser">${vehInfo.purchaser}</span>
				                    </div>
		               		 </div>
		               		   <div class="fieldBox col_50">
				                    <div class="label">购方税号</div>
				                    <div class="field">
				                        ${vehInfo.payercode}
				                    </div>
		               		 </div>
		               		  <div class="fieldBox col_50">
				                    <div class="label">车辆类型</div>
				                    <div class="field">
				                    <span id="vehType">${vehInfo.vehType}</span>
				                    </div>
		               		 </div>
		               		  <div class="fieldBox col_50">
				                    <div class="label">厂牌型号</div>
				                    <div class="field">
				                        ${vehInfo.manumode }
				                    </div>
		               		 </div>
		               		   <div class="fieldBox col_50">
				                    <div class="label">产地</div>
				                    <div class="field">
				                        ${vehInfo.producer }
				                    </div>
		               		 </div>
		               		  <div class="fieldBox col_50">
				                    <div class="label">合格证号</div>
				                    <div class="field">
				                        ${vehInfo.certificateNo }
				                    </div>
		               		 </div>
		               		   <div class="fieldBox col_50">
				                    <div class="label">进口证明书</div>
				                    <div class="field">
				                        ${vehInfo.importCert}
				                    </div>
		               		 </div>
		               		  <div class="fieldBox col_50">
				                    <div class="label">商检单号</div>
				                    <div class="field">
				                       ${vehInfo.inspectNo}
				                    </div>
		               		 </div>
		               		   <div class="fieldBox col_50">
				                    <div class="label">发动机号</div>
				                    <div class="field">
				                        ${vehInfo.enginenum }
				                    </div>
		               		 </div>
		               		   <div class="fieldBox col_50">
				                    <div class="label">车驾号/VIN码</div>
				                    <div class="field">
				                       ${vehInfo.vinnum }
				                    </div>
		               		 </div>
		               		   <div class="fieldBox col_50">
				                    <div class="label">合计金额（税价合计）</div>
				                    <div class="field">
				                       ${vehInfo.pricetax}
				                    </div>
		               		 </div>
		            
		               		    <div class="fieldBox col_50">
				                    <div class="label">销方名称（销货单位名称）</div>
				                    <div class="field">
				                        ${vehInfo.saler }
				                    </div>
		               		 </div>
		               		    <div class="fieldBox col_50">
				                    <div class="label">销方电话</div>
				                    <div class="field">
				                        ${vehInfo.salesPhone}
				                    </div>
		               		 </div>
		               		 
		               		 <div class="fieldBox col_50">
				                    <div class="label">销方税号</div>
				                    <div class="field">
				                        ${vehInfo.taxpayer}
				                    </div>
		               		 </div>
		               		 
		               		<div class="fieldBox col_50">
				                    <div class="label">销方开户账号</div>
				                    <div class="field">
				                        ${vehInfo.salesAccount}
				                    </div>
		               		 </div>
		               		 
		               		 <div class="fieldBox col_50">
				                    <div class="label">销方开户银行</div>
				                    <div class="field">
				                        ${vehInfo.salesBank}
				                    </div>
		               		 </div>
		               		 <div class="fieldBox col_50">
				                    <div class="label">销方地址</div>
				                    <div class="field">
				                        ${vehInfo.salesAddr}
				                    </div>
		               		 </div>
		               		 <div class="fieldBox col_50">
				                    <div class="label">销方地址/电话</div>
				                    <div class="field">
				                        ${vehInfo.salesAddrPhone}
				                    </div>
		               		 </div>
		               		 <div class="fieldBox col_50">
				                    <div class="label">税率 (%)</div>
				                    <div class="field">
				                        ${vehInfo.taxrate}
				                    </div>
		               		 </div>
		               		 <div class="fieldBox col_50">
				                    <div class="label">税额</div>
				                    <div class="field">
				                        ${vehInfo.tax}
				                    </div>
		               		 </div>
		               		 <div class="fieldBox col_50">
				                    <div class="label">主管税务机关名称</div>
				                    <div class="field">
				                        ${vehInfo.taxOffice}
				                    </div>
		               		 </div>
		               		 <div class="fieldBox col_50">
				                    <div class="label">主管税务机关代码</div>
				                    <div class="field">
				                        ${vehInfo.taxOfficeCode}
				                    </div>
		               		 </div>
		               		 <div class="fieldBox col_50">
				                    <div class="label">不含税单价</div>
				                    <div class="field">
				                        ${vehInfo.noTax}
				                    </div>
		               		 </div>
		               		 <div class="fieldBox col_50">
				                    <div class="label">完税凭证号码</div>
				                    <div class="field">
				                        ${vehInfo.payTaxCode}
				                    </div>
		               		 </div>
		               		 <div class="fieldBox col_50">
				                    <div class="label">吨位</div>
				                    <div class="field">
				                        ${vehInfo.tonnage}
				                    </div>
		               		 </div>
		               		 <div class="fieldBox col_50">
				                    <div class="label">限乘人数</div>
				                    <div class="field">
				                        ${vehInfo.maxPassenger}
				                    </div>
		               		 </div>
		               		 
		               		 <div class="fieldBox col_50">
				                    <div class="label">开票人</div>
				                    <div class="field">
				                        ${vehInfo.issued}
				                    </div>
		               		 </div>
		               		 <div class="fieldBox col_50">
				                    <div class="label">机器编号</div>
				                    <div class="field">
				                       ${vehInfo.machinecode}
				                    </div>
		               		 </div>
                              <div class="fieldBox col_50"  style="display: none">
                                <div class="field"> 
                              		<input  id="invoinceId" type="text"  value="${vehInfo.id }" >
                              		<input  id="dtlId" type="text"  value="${vehInfo.dtlId }" >
                              		<input   id="up_file_id" value="${vehInfo.fileId }">
                                </div>
                            </div>
						</div>
                    </form>
                    </div>
	</div>
<script type="text/javascript">

var id = '${id}';// 当前记录id
var detailFlag = '${detailFlag}';
var dtlId = '${vehInfo.dtlId }';
var imgPath = '${imgPath}';
var buOrgCd='${buOrgCd}';
var prjTypCd = "${prjTypCd}";//项目类型
var isGpsNode = "${isGpsNode}";//是否风控审批GPS节点，0-否，1-是
var audStsCd = "${audStsCd}";//发票审核状态
var wait_dialog;

$(function () {

	 var ligerForm = liger.get("prj_prd_veh_info_form");
		$("#prj_prd_veh_info_form").ligerForm({
		    validate: true
		});
		  /*  if (buOrgCd == "00000013") {
	           $("span[isValid='newEngery']").each(function () {
	               $("input[isValid='newEngery']").each(function () {
	                   $(this).attr("validate", "");
	               });
	               $(this).hide();
	           });
	       } */
	       prjPrdVehImgList();
	/* if(detailFlag =="true"){
		$("#prj_prd_veh_info_add_btn_id").hide();
		$("#addGps").hide();
		$("span[id='deleteButton']").each(function(){
			$(this).hide();
		});
	} */
	
	//scanData();
});



function prjDetailBtn(id){
	var fromPrjFlag = true;
	var detailFlag = true;
	var _flag = $("#fromPrjFlagId").val();
	if(StringUtils.isNotEmpty(_flag)){
		if(_flag == 'false'){
			fromPrjFlag = false;
		}
	}
	Add_navTab('tab_project_detail'+id,'项目详情','<%=path%>/project/prjbscinfo/toModifyPage.do?fromPrjFlag='+fromPrjFlag+'&&id='+id+'&&detailFlag='+detailFlag);
}

function prjPrdVehImgList(){
	var dtlId = '${dtlId}';
	var params = {};
	var fileId=$('#up_file_id').val();
	//params.fileId = fileId;
    var url = '<%=path%>/project/prjPrdInvoice/getPrjPrdInvoiceImg.do?';
    $.ajax({
		type: 'post',
		dataType:'json',
		data:{'fileId':fileId},
		url: url,
		success:function(msg){
			 if(msg.success == 1){
				 if(msg.data&&msg.data.length>0){
					 initImgData(msg.data);
				 }
			 }
		}
	});
}

function initImgData(data){
	 if(data&&data.length>0){
		var html = "";
	      html+="<tr>";
	      for(var i=0;i<data.length;i++){
	    	  var file = data[i];
	    	  if((i+1)%4==0){
	    		  html+="</tr>";
	    		  html+="<tr>";
	    	  }
	    	  html+="<td>";
	    	  html+="<div class='imgBox'>";
	    	  html+="<img id='imgPath' src='"+file.filePath+"' onclick='scanData(this,event);'  href='"+file.filePath+"'>";
	       	  html+="</div>";
	    	  html+="</td>";
	      }
	      html+="</tr>";
	     $("#imgTable").html(html); 
	}
}

function payDetailBtn(prjPrdDtlId,id,prjPrdId,prjId){
	if(null==id){
		id = "";
	}
	if(null==prjPrdDtlId){
		prjPrdDtlId = "";
	}
	if(null==prjPrdId){
		prjPrdId = "";
	}
	var editFlag = true;
	Add_navTab('tab_prj_quat_prps'+id,'查看支付表','<%=path%>/project/prjprdpayschm/toAddPage.do?prjId='+prjId+'&&id='+id+'&&prjPrdDtlId='+prjPrdDtlId+'&&prjPrdId='+prjPrdId+'&&detailFlag='+editFlag);
}

	
  function scanData(img,event){
	            event.preventDefault();
	            var href = $(img).attr('src'); 
	           // var href = "http://10.10.36.18/attachments/CCI20170301_0004.JPG";
	            if (SQ.regs.img.test(href)) {
	            	SQ.imgPreview(href);
	            }else{
	                alert('不是图片');
	            };
  }


	function uploadFile(imgObj,sysCd,orgCd,cfgCd,cfgDtlCd){
		var obj = $(imgObj).parent().parent().find("img")
		var dtlId = '${dtlId}';
		var  url = '<%=path%>/project/prjprdvehinfo/addPrjPrdImgPage.do?sysCd='+sysCd+'&&orgCd='+orgCd+'&&cfgCd='+cfgCd+'&&cfgDtlCd='+cfgDtlCd+'&&dtlId='+dtlId;
		$.ligerDialog.open({
            height:300,
            width: 600,
            title : '上传图片',
            url: url, 
            showMax: false,
            showToggle: true,
            showMin: false,
            isResize: true,
            slide: false,
            data: {
            	imgObj: obj
            },
        });

		
	}
	


    </script>
</body>
</html>
